<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>商家管理</title>
    <link href="{:C('WEB_URL')}Public/admin/style/base.css" rel="stylesheet" type="text/css" />
    <link href="{:C('WEB_URL')}Public/admin/style/master.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/js/jquery1.9.1.js"></script>
    <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/js/base.js"></script>
    <script>
        function del(id){
            if(confirm('确定要删除记录吗?')){
                var url="__URL__/del/business_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                        $(".list > tbody").children("#J_list"+data['data']).remove();
                    }else{
                        alert(data['info']);
                    }
                })
            }
        }
    </script>
	<style type="text/css">
	.box-info{position:absolute;top:0px;bottom:0;right:0px;left:0px;border:1px solid red;background-color:rgba(144,144,145,0.5);display:none}
	.UE img{height:30px;};
	</style>
</head>
<body>
<body>
    <div id="wrapper">
        <h2>商家管理<a href="{:U('edit')}" class="but_add">添加</a></h2>
        <table class="list">
            <thead>
			<!--筛选-->
		<form action="{:U('index')}" method="post" enctype="multipart/form-data">
        
			商家名称:<input type='text' class='inputText' name='business_name' value="{$_REQUEST['business_name']}"/>&nbsp;&nbsp;
			所属商场:<select name='market_id' style="width:150px;">
							<option value="0">-请选择-</option>
                            <volist name="mlist" id="vo">
							<option <?php if($_REQUEST['market_id']==$vo['market_id']){echo 'selected';} ?> value="{$vo['market_id']}">{$vo['market_name']}</option>
                            </volist>
					 </select>&nbsp;&nbsp;
			楼层:<select name='floor' style="width:150px;">
							<option value="0">-请选择-</option>
							<option <?php if($_REQUEST['floor']=="B2"){echo 'selected';} ?> value="B2">B2</option>
							<option <?php if($_REQUEST['floor']=="B1"){echo 'selected';} ?> value="B1">B1</option>
							<option <?php if($_REQUEST['floor']=="F1"){echo 'selected';} ?> value="F1">F1</option>
							<option <?php if($_REQUEST['floor']=="F2"){echo 'selected';} ?> value="F2">F2</option>
							<option <?php if($_REQUEST['floor']=="F3"){echo 'selected';} ?> value="F3">F3</option>
							<option <?php if($_REQUEST['floor']=="F4"){echo 'selected';} ?> value="F4">F4</option>
							<option <?php if($_REQUEST['floor']=="F5"){echo 'selected';} ?> value="F5">F5</option>
							<option <?php if($_REQUEST['floor']=="F6"){echo 'selected';} ?> value="F6">F6</option>
							<option <?php if($_REQUEST['floor']=="F7"){echo 'selected';} ?> value="F7">F7</option>
							<option <?php if($_REQUEST['floor']=="F8"){echo 'selected';} ?> value="F8">F8</option>
							<option <?php if($_REQUEST['floor']=="F9"){echo 'selected';} ?> value="F9">F9</option>
							<option <?php if($_REQUEST['floor']=="F10"){echo 'selected';} ?> value="F10">F10</option>
					 </select>
			是否推荐:<select name='status' style="width:150px;">
									<option value="0">-请选择-</option>
									<option <?php if($_REQUEST['status']==1){echo 'selected';} ?> value="1">不推荐</option>
									<option <?php if($_REQUEST['status']==2){echo 'selected';} ?> value="2">推荐</option>
                            </select>
			<input type='submit' value='搜索' class='btnOrange'>
		</form>
                <tr>
					<th>商家ID</th>
					<th>商家名称</th>
					<th>商场名称</th>
					<th>商家logo</th>
					<th>联系方式</th>
					<th>楼层</th>
					<th>地址</th>
					<th>是否推荐</th>
					<th>状态</th>
					<th>审核</th>
					<th>操作</th>
					
                </tr>
            </thead>  
            <tbody id='tb'>
            <volist name='list' id='vo'>
                <tr align="center" id="J_list{$vo['business_id']}">
                    <td>{$vo['business_id']}</td>
                    <td>{$vo['business_name']}</td>
                    <td>{$vo['market_name']}</td>
                    <td><?php if($vo['small_logo']){ ?><img src ="{:C('WEB_URL')}{$vo['small_logo']}" style="width:40px;" ><?php }else{ echo '暂无';}?></td>
                    <td>{$vo['tel']}</td>
                    <td>{$vo['floor']}</td>
                    <td>{$vo['address']}</td>
                    <td><?php if($vo['status']==2){echo "推荐";}else{echo "不推荐";} ?></td>
                      <td><?php if($vo['statuss']==1){echo "启用";}else{echo "禁用";} ?></td>
                    <td><button abs="{$vo['statuss']}" abss="{$vo['business_id']}" class='button'><?php if($vo['statuss']==1){echo "禁用";}else{echo "启用";} ?></button></td>
                    <td>
                       <!-- <empty name="_GET['id']"><a href="{:U('orderInfo',array('order_id'=>$vo['order_id']))}"  target="_self" class="edit" >查看详情</a></empty> -->
                        
                           
                        <a href="{:U('edit',array('business_id'=>$vo['business_id']  ,  'nowPage'  =>$nowPage ))}" class="edit" >编辑</a>
                         
                         <a href="{:U('Buser/edit',array('business_id'=>$vo['business_id']  ,  'nowPage'  =>$nowPage ))}" class="edit" >账户管理</a>
                              
                        <!-- <span class="del" onClick="del({$vo['business_id']})">删除</span> -->
                    </td>
       
                </tr>
            </volist>
            </tbody>
        </table>
        <p class="hr_10"></p>
        <div class="pages">{$page} </div>
    </div>
	
	<div class='box-info'>
	</div>
<script type="text/javascript">
	  $(document).on("click","a.J_itemDel",function(){
                $(this).parent("li").remove();
            })
	  $('#tb .button').click(function(){
	  	var vars=$(this).attr('abs');
	  	var sid=$(this).attr('abss');
	  	var mythis=$(this);
	  
	  	$.ajax({
						  type:'POST',
						  url:"statuss",
						  dataType: "json",
						  data: 'statuss='+vars+'&sid='+sid,
						  success:function(data){
							  
				
						  	if(data==1){
						  		
						  		
						  		mythis.html('禁用');
						  		mythis.attr('abs','1');
						  	}else{
						  		
						  		mythis.html('启用');
						  		
						  		mythis.attr('abs','2')
						  	}
						  }
				})
	  })
</script>
</body>
</html>